<%@ page language="java"
	import="java.util.*,java.lang.*,com.firesrc.bean.MailHost"
	contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>邮箱列表</title>
	<script src='/dwr/util.js'></script>
<script src='/dwr/engine.js'></script>
<script src='/dwr/interface/MailHostAction.js'></script>
<script src='/js/mailHost.js'></script>
</head>
<body>
	<h2>邮箱列表</h2>
	
	<form action="/MailHostServlet">
		每种类型邮箱数量<input type="text" name="count">(必填) <input
			type="hidden" value="reset" name="type"> <input type="submit">
	</form>
	<div style="text-align: center;">
	<%
		List<MailHost> list = (List) request.getAttribute("list");
		Map<String, Integer> map = (Map) request.getAttribute("map");
		Set<String> keySet = map.keySet();
		for (String string : keySet) {
	%>
	<a href="/MailHostServlet?kind=<%=string%>"><%=string%> (<%=map.get(string)%>)</a>&nbsp;
	<%
		}
	%>
	<input type="hidden" id="id">
	
	<a href="/MailHostServlet">查看全部</a> |<a href="/MailHostServlet?type=disableAll">全部禁用</a>||<a href="/MailHostServlet?type=enableAll">全部启用</a>
	</div>
	<form action="">
		<input type="hidden" name="type" value="add">
		<table border="1">
			<tbody align="left">
				<tr>
					<td>邮箱</td>
					<td>用户名</td>
					<td>密码</td>
					<td>&nbsp;&nbsp; SMTP</td>
					<td>邮箱</td>
					<td>单次</td>
					<td>每天</td>
					<td>SSl</td>
					<td>状态</td>
					<td>顺序</td>
					<td>设置</td>
					<td>编辑</td>
					<td>修改</td>
					<td><input type="button" value="全部检查" name="checkAllButton" onclick="chellAll()"></td>
				</tr>
				<tr>
					<td><input id="mail" type="text" ></td>
					<td><input id="userName" type="text" style="width:80px" ></td>
					<td><input id="password" type="text" style="width:80px"></td>
					<td><input id="hostName" type="text" style="width:100px"></td>
					<td><input id="kind" type="text" style="width:40px"></td>
					<td><input id="sendOnceMaxCount" type="text" style="width:30px"></td>
					<td><input id="sendDayMaxCount" type="text" style="width:30px"></td>
					<td><input id="ssl" type="text" style="width:30px"></td>
					<td><input id="state" type="text" style="width:20px"></td>
					<td><input id="seq" type="text" style="width:20px"></td>
					<td><input type="button" value="保存" onclick="save()"></td>
					<td colspan="3"><input type="text" id="toMail" style="width:160px"> </td>
				</tr>
				<%
					for (MailHost mailHost : list) {
				%>
					<input type="hidden" id="userName<%=mailHost.getId()%>" value="<%=mailHost.getUserName()%>">
					<input type="hidden" id="mail<%=mailHost.getId()%>" value="<%=mailHost.getMail()%>">
					<input type="hidden" id="password<%=mailHost.getId()%>" value="<%=mailHost.getPassword()%>">
					<input type="hidden" id="hostName<%=mailHost.getId()%>" value="<%=mailHost.getHostName()%>">
					<input type="hidden" id="ssl<%=mailHost.getId()%>" value="<%=mailHost.isSsl()%>">
				<tr>
					<td><div id="div<%=mailHost.getId()%>" ><%=mailHost.getMail()%></div><input type="hidden" id="mail<%=mailHost.getId()%>"> </td>
					<td><%=mailHost.getUserName()%></td>
					<td><%=mailHost.getPassword()%></td>
					<td><%=mailHost.getHostName()%></td>
					<td><%=mailHost.getKind()%></td>
					<td><%=mailHost.getSendOnceMaxCount()%></td>
					<td><%=mailHost.getSendDayMaxCount()%></td>
					<td><%=mailHost.isSsl()%></td>
					<td><%=mailHost.getState()%></td>
					<td><%=mailHost.getSeq()%></td>
					<%
						if ("1".equals(mailHost.getState())) {
					%>
					<td><a
						href="/MailHostServlet?type=disable&id=<%=mailHost.getId()%>">禁用</a></td>
					<%
						} else {
					%>
					<td><a
						href="/MailHostServlet?type=enable&id=<%=mailHost.getId()%>"><font
							color="green">启用</font></a></td>
					<%
						}
					%>
					<td><a
						href="/MailHostServlet?type=del&id=<%=mailHost.getId()%>">删除</a></td>
							<td><input type="button" value="修改" id="<%=mailHost.getId()%>" onclick="modify(this)"></td>
					<td><input type="button" value="检查" id="button<%=mailHost.getId()%>" onclick="checkMailFromList(this)" name="checkButton"></td>
				</tr>
				<%
					}
				%>
			</tbody>
		</table>
	</form>
</body>
</html>